let initdata = {
    name:"zhangsan",
    arr:[],
}
let appreducer = (state=initdata,action)=>{
    if (action.type === "setname") {
        return {
            ...state,
            name:"lisi"
        }

    } else if (action.type ==="setname1") {
        return {
            ...state,
            name:action.payload
        }
    } else if (action.type === "getlist") {
        return {
            ...state,
            arr:action.payload
        }

    }
     else {
        return {
            ...state
        }
    }
   
}
// reducer 是一个函数，函数接收两个参数，第一个参数state，第二个参数action
// action 
// dispatch 
// state
export default appreducer